package keter.security;

import keter.model.User;

/**
 * Defines default empty user - anonymous user - returned when no one is logged
 * in the system.
 * 
 * @author Dawid Fatyga
 */
public class AnonymousUserAdapter extends UserAdapter {
	
	public static final String ANONYMOUS_USERNAME = "Guest";
	public static final String ANONYMOUS_NAME = "访客";
	public static final String ANONYMOUS_ROLE_NAME = "ANONYMOUS";
	
    private static final long serialVersionUID = 1153278300924661257L;

    User user = new User();

    @Override
    public User getUser() {
        init();
        return user;
    }

    @Override
    public String getUsername() {
        return user.getStr("username");
    }

    private void init() {
        user.set("username", ANONYMOUS_USERNAME);
        user.set("name", ANONYMOUS_NAME);
    }
}
